package hu.debrecen.adastra.card.service.domain;

import java.util.Collections;
import java.util.List;

public abstract class AbstractDeck<C extends Card> implements Deck<C> {

	private final List<C> cards;

	public AbstractDeck(final List<C> cards) {
		super();
		this.cards = cards;
		Collections.shuffle(cards);
	}

	@Override
	public C nextCard() {
		return this.cards.remove(0);
	}

	@Override
	public boolean isEmpty() {
		return this.size() == 0;
	}

	@Override
	public int size() {
		return this.cards.size();
	}

}
